package com.sun.dailyprj.provider;

import android.net.Uri;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.sun.dailyprj.util.Logger;

public class RemoteIpcServer extends IpcServer implements RemoteIpcServerStub{
//    public static final String URI = "content://com.sun.dailyprj.provider.RemoteIpcServer";
    private static final String URI = "content://com.sun.dailyprj.provider";
    private Dispatcher mDispatch;
    public RemoteIpcServer(){
        mDispatch = Dispatcher.getInstance();
        Logger.warn("RemoteIpcServer()");
    }

    @Override
    public boolean onCreate() {
        return false;
    }

    @Nullable
    @Override
    public Bundle call(@NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
        Logger.debug("call() method:" + method);
        return mDispatch.process(method,arg,extras);
       /* if(method.equals("updateSetting")){
            return updateSetting();
        }else if(method.equals("updateVideo")){
            return updateVideo((String) extras.get("msg"));
        }
        return null;*/
    }

    @Override
    public Bundle updateVideo(String path) {
        Bundle bundle = new Bundle();
        bundle.putString("msg","Remote:" + path);
        Logger.debug("updateVideo() bundle:" + bundle.toString());
        return bundle;
    }

    @Override
    public Bundle updateSetting() {
        Bundle bundle = new Bundle();
        bundle.putString("msg","updateSettings");
        return bundle;
    }
}
